<template>
	<view>
		<view v-for="(item, yaofang_index) in yaofang.list" :key="yaofang_index" class="order" @click="goto_yaofang_info(item.id)">
			<view class="username">
				{{item.user.name}}
			</view>
			<view>
				<text>联系方式</text>
				<text>{{item.user.tel}}</text>
			</view>
			<view>
				<text>诊断</text>
				<text>{{item.name}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import { yaoshi_get_yaofang_list } from '@/util/api/api.js';
	
	export default {
		data() {
			return {
				url:{
					get_yaofang_list_url:'/index.php/html5/yaoshi/get_yaofang_list'
				},
				yaofang:{
					list:[],
					curpage:0,
					listnum:20,
					total:0
				},
			}
		},
		onLoad() {
			this.get_yaofang_list()
		},
		methods: {
			goto_yaofang_page(id=0){
				uni.navigateTo({
					url: '../yaoshi/yaofang?id='+id
				});
			},
			get_yaofang_list(curpage=0,listnum=0){
				let that = this
				let data = {
					curpage:curpage,
					listnum:listnum
				}
				
				yaoshi_get_yaofang_list(data).then((res)=>{
					if (res.code==200) {
						that.yaofang.list.push(...res.data.datalist)
						that.yaofang.curpage = res.data.pages
						that.yaofang.total = res.data.total
					} else{
						// that.showToast(res.message)
					}
				})
			},
			goto_yaofang_info(id){
				uni.navigateTo({
					url: '../yaoshi/yaofang?id='+id
				});
			},
		}
	}
</script>

<style scoped>
page{
	background-color: #F5F5F5;
}
.order{
	width: 690rpx;
	margin: 30rpx;
	padding: 30rpx;
	background: #FFFFFF;
	border-radius: 8px;
}
.username{
	font-size: 36rpx;
	font-weight: bold;
	color: #333333;
	line-height: 77rpx;
}
</style>